//
//  ScrollView.m
//  05-UI
//
//  Created by Snow on 16/7/20.
//  Copyright © 2016年 Snow. All rights reserved.
//

#import "ScrollView.h"

@implementation ScrollView

- (instancetype)initWithFrame:(CGRect)frame images:(NSArray<UIImage *> *)images delegate:(id)delegate
{
    self = [super initWithFrame:frame];
    if (self) {
        [self configWithFrame:frame images:images delegate:delegate];
    }
    return self;
}
- (void)configWithFrame:(CGRect)frame images:(NSArray *)array delegate:(id)delegate
{
    self.contentSize = CGSizeMake(frame.size.width * array.count, frame.size.height);
    self.contentOffset = CGPointMake(frame.size.width, 0);
    for (NSInteger i = 0; i < array.count; i++) {
        UIImageView *imageView = [[UIImageView alloc] initWithImage:array[i]];
        imageView.frame = CGRectMake(frame.size.width * i, 0, frame.size.width, frame.size.height);
        [self addSubview:imageView];
        
    }
    self.pagingEnabled = YES;
    self.bounces = NO;
    
}
@end
